import { createVuePlugin } from 'vite-plugin-vue2'
import { resolve } from 'path';
import { viteMockServe } from "vite-plugin-mock";

export default {
  plugins: [
		createVuePlugin(),
		viteMockServe({
      supportTs: false,
    }),
	],
  resolve: {
		alias: {
			'@': resolve(__dirname, './src'),
      // fix:vue版本和el-ui使用的vue版本不一致，导致的el-table不显示
			vue: 'vue/dist/vue.esm.js'
		}
	},
  server: {
    host: "0.0.0.0",
    port: 3100,
    open: false,
    proxy: {
      "/api": {
        target: `http://localhost:8000`,
        ws: true,
        changeOrigin: true,
      },
      "/mock": {
        target: `http://localhost:${3100}`,
        ws: true,
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/mock/, ""),
      },
    },
  },
}